package com.sk.cardeal.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sk.cardeal.R;
import com.sk.cardeal.entity.ScanGoodEntity;

import java.util.List;

/**
 * Created by sk on 2018/3/22.
 */

public class ScanGoodAdapter extends BaseQuickAdapter<ScanGoodEntity.ReturnObjectBean,BaseViewHolder> {

    public ScanGoodAdapter(int layoutResId, @Nullable List<ScanGoodEntity.ReturnObjectBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, ScanGoodEntity.ReturnObjectBean item) {


        String qs = "";
        switch (item.getQuality()){
            case 1:
                qs = "原厂件";
                break;
            case 2:
                qs = "品牌件";
                break;
            case 3:
                qs = "改装件";
                break;
            case 4:
                qs = "自制件";
                break;
            case 5:
                qs = "修复件";
                break;
            case 6:
                qs = "拆车件";
                break;
        }

        helper.setText(R.id.tv_name,item.getPartName())
                .setText(R.id.tv_quality,qs)
                .setText(R.id.tv_code,"编码："+item.getGoodsCode())
                .setText(R.id.tv_stock,"库存："+item.getStockNum())
                .setText(R.id.tv_num,String.valueOf(item.getScanCount()));
    }
}
